Repository navigation
Conversation
This change adds `as_read_only` method that returns a reference struct pointing to the `DeviceTreeNode` and removes `impl Node for &DeviceTreeNode`. There are two main reasons for making this change: * Unifying `FdtNodeMut` and `DeviceTreeNode` - since `FdtNodeMut` contains a mutable reference, it cannot be `Copy`, so for the `Node` trait implementation it exposes its own `as_read_only` method. * This allows us to properly store `parent_address_space` in objects returned by `child()`, `find_node`, etc. without any lifetime issues, self-referential structs, mutability problems, or similar. The main tradeoff is convenience - the users would need to call `as_read_only()` for every reading operation. To avoid this, convenience wrapper methods are added and unified via a macro shared by `FdtNodeMut` and `DeviceTreeNode`.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #96 +/- ##
==========================================
+ Coverage 93.16% 93.38% +0.22%
==========================================
Files 26 26
Lines 3336 3358 +22
==========================================
+ Hits 3108 3136 +28
+ Misses 228 222 -6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change adds
as_read_onlymethod that returns a reference struct pointing to theDeviceTreeNodeand removesimpl Node for &DeviceTreeNode.There are two main reasons for making this change:
FdtNodeMutandDeviceTreeNode- sinceFdtNodeMutcontains a mutable reference, it cannot beCopy, so for theNodetrait implementation it exposes its ownas_read_onlymethod.parent_address_spacein objects returned bychild(),find_node, etc. without any lifetime issues, self-referential structs, mutability problems, or similar.The main tradeoff is convenience - the users would need to call
as_read_only()for every reading operation. To avoid this, convenience wrapper methods are added and unified via a macro shared byFdtNodeMutandDeviceTreeNode.